﻿Public Class Util

    Public Shared Function EhVazioNull(ByVal objValor) As Boolean
        Try

            If IsDBNull(objValor) Then
                Return True
            ElseIf objValor = Nothing Then
                Return True
            ElseIf Trim(objValor) = "" Or Trim(objValor) = "(Todos)" Then
                Return True
            ElseIf objValor.GetType.Name.Equals("DateTime") And objValor = Nothing Then
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            Return False
        End Try


    End Function

    Public Shared Sub LogTxt(ByVal str As String)
        'AppDomain.CurrentDomain.BaseDirectory + AppDomain.CurrentDomain.RelativeSearchPath + "
        Dim str1 As String
        Dim str2 As String
        str1 = AppDomain.CurrentDomain.BaseDirectory
        str2 = AppDomain.CurrentDomain.RelativeSearchPath
        Dim ioFile As System.IO.StreamWriter = New System.IO.StreamWriter(str2 + "\log\lada.log", True)
        ioFile.WriteLine(Date.Now + " " + str)
        ioFile.Close()
    End Sub

    Public Shared Sub LogAccess(ByVal str As String)
        Dim ta As DataSet1TableAdapters.LogTableAdapter = New DataSet1TableAdapters.LogTableAdapter
        Dim table As DataSet1.LogDataTable = New DataSet1.LogDataTable
        Dim row As DataSet1.LogRow = table.NewRow()
        row.Comando = Date.Now + " " + str
        table.Rows.Add(row)
        ta.Update(table)
    End Sub
End Class
